export default{
	getLocalTime:function(ns,e) {//时间戳转换  年月日  时分秒
		if(ns==null||ns==0){return "";}
		var d = new Date(Number(ns));
		var years=d.getFullYear();
		var months=d.getMonth()+1;
		if(months<10){months='0'+months};
		var dates= d.getDate();
		if(dates<10){dates='0'+dates};
		var hours=d.getHours();
		if(hours<10){hours='0'+hours};
		var minutes=d.getMinutes();
		if(minutes<10){minutes='0'+minutes};
		var seconds=d.getSeconds();
		if(seconds<10){seconds='0'+seconds};
        switch(Number(e)){
            case 1://年月日
                return years+'-'+months+'-'+dates
            case 2://年月
                return years+'-'+months
            default:////年月日时分秒
                return years+'-'+months+'-'+dates+' '+hours+':'+minutes+':'+seconds
        }
	},
	getTimeStamp0:function(e){//0.00.00点时间戳
        var date = new Date();
        if(e>0||e<0){
        	date.setTime(date.getTime()+ Number(e)*24*60*60*1000)
        }else{
        	date.setTime(date.getTime())
        }
        date.setHours(0);
        date.setMinutes(0);
        date.setSeconds(0);
        return parseInt(date.getTime()/1000);
    },
    getTimeStamp24:function(e){//23.59.59时间戳
        var date = new Date();
        if(e>0||e<0){
        	date.setTime(date.getTime()+ Number(e)*24*60*60*1000)
        }else{
        	date.setTime(date.getTime())
        }
        date.setHours(23);
        date.setMinutes(59);
        date.setSeconds(59);
        return parseInt(date.getTime()/1000);
    },
    dowload :function(url,paramsStr) {//下载表单
        var downLoadUrl = url + "?" + paramsStr
        var a = document.createElement('a');
        a.href = downLoadUrl;
        a.download = downLoadUrl;
        a.click();
        return false;
    },
    coyObj:function (dest,orig) {
      for (let key in dest) {
        dest[key] = orig[key];
      }
    },
    speck:function(str){
        var url = "http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=" + encodeURI(str);// baidu
        var n = new Audio(url);
        n.src = url;
        n.play();
    },
    getDomain:function(){
        switch(document.domain){
            case "cypos.hulupos.com":
                return "hulu"
            default:
                return "caiyu"
        }
    }
}